﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ControlTemplate x:Key="RefreshButtonTemplate" TargetType="{x:Type Button}">
        <Button Padding="{TemplateBinding Padding}">
            <TextBlock Text="P" Foreground="Black" FontWeight="ExtraLight" FontFamily="Wingdings 3" x:Name="rototototo" FontSize="14" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                    <TextBlock.RenderTransform>
                        <RotateTransform x:Name="rototototoTransform" Angle="80"/>
                    </TextBlock.RenderTransform>
            </TextBlock>
        </Button>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="rototototo" Property="Opacity" Value="0.3"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="rototototoTransform" Storyboard.TargetProperty="Angle" RepeatBehavior="Forever">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="440">
                                    <EasingDoubleKeyFrame.EasingFunction>
                                        <CubicEase EasingMode="EaseInOut"/>
                                    </EasingDoubleKeyFrame.EasingFunction>
                                </EasingDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="rototototoTransform" Storyboard.TargetProperty="Angle">
                                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="80">
                                    <EasingDoubleKeyFrame.EasingFunction>
                                        <BackEase EasingMode="EaseOut"/>
                                    </EasingDoubleKeyFrame.EasingFunction>
                                </EasingDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>